/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 */

import {
  getModuleNameFromTaskPath,
  getTaskNameFromTaskPath,
  validateTaskPath
} from '../../../../../../src/base/internal/task/util/task-path-util';

describe('test path util', () => {
  const moduleName = 'entry';
  const taskName = 'task1';
  const taskPath = 'entry:task1';

  test('test create task path', () => {
    expect(taskPath).toBe('entry:task1');
  });

  test('test get task name', () => {
    expect(getModuleNameFromTaskPath(taskPath)).toBe(moduleName);
  });

  test('test get task name', () => {
    expect(getTaskNameFromTaskPath(taskPath)).toBe(taskName);
  });

  test('error task path', () => {
    const errorTaskPath = 'entry:task:1';
    expect(() => validateTaskPath(errorTaskPath));
  });
});
